﻿using System;
using System.Collections.Generic;

namespace EvoBoost.Core
{
	public class MisclassificationLossFunction : ILossFunction
	{
		public double Calculate(double expectedOutcome, double realOutcome)
		{
			if (expectedOutcome != 1 && expectedOutcome != -1)
				throw new ArgumentOutOfRangeException("expectedOutcome", "Expected outcome must be either -1 or 1.");
			
			return Math.Sign(realOutcome) == expectedOutcome ? 0 : 1;
		}

		public double Minimize(IList<double> previouslyBoostedOutcomes, IList<double> expectedOutcomes)
		{
			throw new NotImplementedException();
		}

		public double FindOptimalSplit(IList<double> previouslyBoostedOutcomes, IList<double> expectedOutcomes, IList<double> splitterValues)
		{
			throw new NotImplementedException();
		}

		public override string ToString()
		{
			return "Misclassification loss";
		}
	}
}
